package com.tarena.lbs.basic.web.controller;

import com.tarena.lbs.base.protocol.exception.BusinessException;
import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.basic.web.service.LoginService;
import com.tarena.lbs.pojo.passport.param.AdminLoginParam;
import com.tarena.lbs.pojo.passport.vo.LoginVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 专门负责处理 全局登录接口的控制层
 */
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;
    /**
     * 参考接口文件
     * 请求地址: /passport/admin/login
     * 请求方式: post
     * 请求参数: AdminLoginParam param
     * 返回值:  Result<LoginVO></LoginVO>
     */
    @PostMapping("/passport/admin/login")
    public Result<LoginVO> adminLogin(AdminLoginParam param) throws BusinessException {
        LoginVO vo = loginService.adminLogin(param);
        return new Result<>(vo);
    }
}
